<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;



/**
 * 商铺控制器
 */
class Otcshop extends AdminBase
{


    



    /**
     *商铺列表
     */
    public function shop_list()
    {

        $this->assign('list', $this->logicShop->getShopList($this->param,'a.*,c.username,c.is_company,c.mobile,c.create_time as reg_time,c.is_king','a.create_time desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }

    /**
     *商铺列表
     */
    public function shop_statistics_list()
    {

        $this->assign('list', $this->logicShop->getShopStatisticsList($this->param,'a.*,c.username,c.is_company,c.mobile,c.create_time as reg_time,c.is_king','a.create_time desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }

    /**
     *申请商铺列表
     */
    public function apply_shop_list()
    {
        $this->param['is_apply']=1;
        $this->assign('list', $this->logicShop->getShopList($this->param,'a.*','a.create_time desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }




    /**
     * 添加商铺
     */
    public function ShopAdd()
    {

        IS_POST && $this->jump($this->logicShop->ShopAdd($this->param));

        return $this->fetch('shop_add');
    }


    /**
     * 编辑商铺
     */
    public function ShopEdit()
    {

        IS_POST && $this->jump($this->logicShop->ShopEdit($this->param));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('info', \app\common\model\OtcShop::get($this->param['id']));
        return $this->fetch('shop_edit');
    }
    /**
     * 查看审核商铺
     */
    public function ShopCheckEdit()
    {

        IS_POST && $this->jump($this->logicShop->ShopEdit($this->param));
//        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('info', \app\common\model\OtcShop::get($this->param['id']));
        $this->assign('poundage',getConfig('otc_apply_shop_poundage'));
        return $this->fetch('shop_check_edit');
    }



    /**
     * 数据状态设置
     */
    public function setStatus()
    {

        $this->jump($this->logicAdminBase->setStatus('OtcShop', $this->param));
    }


    /**
     * 编辑商铺
     */
    public function update_info()
    {

        $this->jump($this->logicShop->update_info($this->param));

    }

    /**
     *商铺转入法币列表
     */
    public function shop_currency_list()
    {

        $this->assign('list', $this->logicShop->getShopCurrencyList($this->param,'a.*,c.username,c.mobile,c.is_company,s.shop_name,c.create_time as reg_time','a.create_time desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }

    /**
     * 商铺转入法币审核
     */
    public function shop_currency_check()
    {

        $this->jump($this->logicShop->shop_currency_check($this->param));

    }


    /**
     * 排序
     */
    public function setSort()
    {

        $this->jump($this->logicAdminBase->setSort('OtcShop', $this->param));
    }


}
